package com.https.url.result;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.net.wifi.WifiManager;
import android.provider.Settings.Secure;
import android.telephony.TelephonyManager;
import com.efs.sdk.base.core.util.NetworkUtil;
import com.efs.sdk.base.protocol.file.section.AbsSection;

public class GoagalInfo {
    public static GoagalInfo goagalInfo = new GoagalInfo();
    public String channel;
    public String configPath;
    public String gamechannelFilename;
    public PackageInfo packageInfo = null;
    public String publicKey;
    public String rasPublickeylFilename;
    public String uuid;

    public GoagalInfo() {
        String str = "";
        this.uuid = str;
        this.channel = "default";
        this.configPath = str;
        this.rasPublickeylFilename = str;
        this.gamechannelFilename = "gamechannel.json";
    }

    public static GoagalInfo get() {
        return goagalInfo;
    }

    public PackageInfo getPackageInfo(Context context) {
        try {
            return context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
        } catch (Exception unused) {
            return null;
        }
    }

    public String getPublicKey(String str) {
        String str2 = "";
        return str.replace("-----BEGIN RSA PRIVATE KEY-----", str2).replace("-----END RSA PRIVATE KEY-----", str2).replace("-----BEGIN PRIVATE KEY-----", str2).replace("-----END PRIVATE KEY-----", str2).replace("-----BEGIN PUBLIC KEY-----", str2).replace("-----END PUBLIC KEY-----", str2).replace("\r", str2).replace(AbsSection.SEP_ORIGIN_LINE_BREAK, str2);
    }

    public String getPublicKeyString() {
        String publicKey2 = getPublicKey(this.publicKey);
        this.publicKey = publicKey2;
        return publicKey2;
    }

    @SuppressLint({"MissingPermission"})
    public String getUid(Context context) {
        String string = Secure.getString(context.getContentResolver(), "android_id");
        if (string == null || string.isEmpty() || string.equals("02:00:00:00:00:00")) {
            string = ((WifiManager) context.getSystemService(NetworkUtil.NETWORK_TYPE_WIFI)).getConnectionInfo().getMacAddress();
        }
        if (string == null || string.isEmpty()) {
            string = ((TelephonyManager) context.getSystemService("phone")).getDeviceId();
        }
        return string == null ? "" : string;
    }

    /* JADX WARNING: type inference failed for: r1v0 */
    /* JADX WARNING: type inference failed for: r1v1, types: [java.util.zip.ZipFile] */
    /* JADX WARNING: type inference failed for: r1v2, types: [java.lang.String] */
    /* JADX WARNING: type inference failed for: r1v3, types: [java.lang.String] */
    /* JADX WARNING: type inference failed for: r1v6, types: [java.lang.String] */
    /* JADX WARNING: type inference failed for: r2v1 */
    /* JADX WARNING: type inference failed for: r1v7, types: [java.util.zip.ZipFile] */
    /* JADX WARNING: type inference failed for: r1v8 */
    /* JADX WARNING: type inference failed for: r2v2 */
    /* JADX WARNING: type inference failed for: r2v3, types: [java.util.zip.ZipFile] */
    /* JADX WARNING: type inference failed for: r4v0 */
    /* JADX WARNING: type inference failed for: r2v4 */
    /* JADX WARNING: type inference failed for: r1v9 */
    /* JADX WARNING: type inference failed for: r1v10 */
    /* JADX WARNING: type inference failed for: r1v11 */
    /* JADX WARNING: type inference failed for: r1v12, types: [java.lang.String] */
    /* JADX WARNING: type inference failed for: r1v13 */
    /* JADX WARNING: type inference failed for: r1v14 */
    /* JADX WARNING: type inference failed for: r1v15 */
    /* JADX WARNING: type inference failed for: r1v16 */
    /* JADX WARNING: type inference failed for: r1v17 */
    /* JADX WARNING: type inference failed for: r1v18 */
    /* JADX WARNING: type inference failed for: r1v19 */
    /* JADX WARNING: Multi-variable type inference failed. Error: jadx.core.utils.exceptions.JadxRuntimeException: No candidate types for var: r1v11
  assigns: []
  uses: []
  mth insns count: 66
    	at jadx.core.dex.visitors.typeinference.TypeSearch.fillTypeCandidates(TypeSearch.java:237)
    	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    	at jadx.core.dex.visitors.typeinference.TypeSearch.run(TypeSearch.java:53)
    	at jadx.core.dex.visitors.typeinference.TypeInferenceVisitor.runMultiVariableSearch(TypeInferenceVisitor.java:99)
    	at jadx.core.dex.visitors.typeinference.TypeInferenceVisitor.visit(TypeInferenceVisitor.java:92)
    	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:27)
    	at jadx.core.dex.visitors.DepthTraversal.lambda$visit$1(DepthTraversal.java:14)
    	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:14)
    	at jadx.core.ProcessClass.process(ProcessClass.java:30)
    	at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:311)
    	at jadx.api.JavaClass.decompile(JavaClass.java:62)
    	at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:217)
     */
    /* JADX WARNING: Removed duplicated region for block: B:22:0x0050 A[SYNTHETIC, Splitter:B:22:0x0050] */
    /* JADX WARNING: Removed duplicated region for block: B:29:0x005d  */
    /* JADX WARNING: Removed duplicated region for block: B:30:0x0063  */
    /* JADX WARNING: Removed duplicated region for block: B:32:0x006b  */
    /* JADX WARNING: Removed duplicated region for block: B:35:0x0077  */
    /* JADX WARNING: Removed duplicated region for block: B:39:0x008c A[SYNTHETIC, Splitter:B:39:0x008c] */
    /* JADX WARNING: Unknown variable types count: 10 */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void init(android.content.Context r6) {
        /*
            r5 = this;
            java.lang.String r0 = d.f.a.b.d.a(r6)
            r5.configPath = r0
            android.content.pm.ApplicationInfo r0 = r6.getApplicationInfo()
            java.lang.String r0 = r0.sourceDir
            r1 = 0
            java.util.zip.ZipFile r2 = new java.util.zip.ZipFile     // Catch:{ Exception -> 0x0049 }
            r2.<init>(r0)     // Catch:{ Exception -> 0x0049 }
            java.lang.String r0 = "META-INF/gamechannel.json"
            java.util.zip.ZipEntry r0 = r2.getEntry(r0)     // Catch:{ Exception -> 0x0042, all -> 0x003f }
            if (r0 == 0) goto L_0x0036
            java.io.InputStream r0 = r2.getInputStream(r0)     // Catch:{ Exception -> 0x0042, all -> 0x003f }
            java.lang.String r1 = d.f.a.b.b.c(r0)     // Catch:{ Exception -> 0x0042, all -> 0x003f }
            java.lang.StringBuilder r0 = new java.lang.StringBuilder     // Catch:{ Exception -> 0x0042, all -> 0x003f }
            r0.<init>()     // Catch:{ Exception -> 0x0042, all -> 0x003f }
            java.lang.String r3 = "渠道->"
            r0.append(r3)     // Catch:{ Exception -> 0x0042, all -> 0x003f }
            r0.append(r1)     // Catch:{ Exception -> 0x0042, all -> 0x003f }
            java.lang.String r0 = r0.toString()     // Catch:{ Exception -> 0x0042, all -> 0x003f }
            d.f.a.b.c.a(r0)     // Catch:{ Exception -> 0x0042, all -> 0x003f }
        L_0x0036:
            r2.close()     // Catch:{ IOException -> 0x003a }
            goto L_0x0059
        L_0x003a:
            r0 = move-exception
            r0.printStackTrace()
            goto L_0x0059
        L_0x003f:
            r6 = move-exception
            r1 = r2
            goto L_0x008a
        L_0x0042:
            r0 = move-exception
            r4 = r2
            r2 = r1
            r1 = r4
            goto L_0x004b
        L_0x0047:
            r6 = move-exception
            goto L_0x008a
        L_0x0049:
            r0 = move-exception
            r2 = r1
        L_0x004b:
            r0.printStackTrace()     // Catch:{ all -> 0x0047 }
            if (r1 == 0) goto L_0x0058
            r1.close()     // Catch:{ IOException -> 0x0054 }
            goto L_0x0058
        L_0x0054:
            r0 = move-exception
            r0.printStackTrace()
        L_0x0058:
            r1 = r2
        L_0x0059:
            java.lang.String r0 = r5.gamechannelFilename
            if (r1 == 0) goto L_0x0063
            java.lang.String r2 = r5.configPath
            d.f.a.b.b.d(r1, r2, r0)
            goto L_0x0069
        L_0x0063:
            java.lang.String r1 = r5.configPath
            java.lang.String r1 = d.f.a.b.b.b(r1, r0)
        L_0x0069:
            if (r1 == 0) goto L_0x006d
            r5.channel = r1
        L_0x006d:
            java.lang.String r0 = r5.rasPublickeylFilename
            java.lang.String r1 = r5.configPath
            java.lang.String r0 = d.f.a.b.b.b(r1, r0)
            if (r0 == 0) goto L_0x007d
            java.lang.String r0 = r5.getPublicKey(r0)
            r5.publicKey = r0
        L_0x007d:
            java.lang.String r0 = r5.getUid(r6)
            r5.uuid = r0
            android.content.pm.PackageInfo r6 = r5.getPackageInfo(r6)
            r5.packageInfo = r6
            return
        L_0x008a:
            if (r1 == 0) goto L_0x0094
            r1.close()     // Catch:{ IOException -> 0x0090 }
            goto L_0x0094
        L_0x0090:
            r0 = move-exception
            r0.printStackTrace()
        L_0x0094:
            throw r6
        */
        throw new UnsupportedOperationException("Method not decompiled: com.https.url.result.GoagalInfo.init(android.content.Context):void");
    }
}
